package com.qf.controller;


import com.qf.bean.AjaxMessage;
import com.qf.entity.Subject;
import com.qf.service.ISubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lcx
 * @since 2020-09-03
 */
@RestController
@RequestMapping("/subject")
public class SubjectController {
    @Autowired
    ISubjectService subjectService;

    @RequestMapping("/select")
    public AjaxMessage selectSubject(){
        List<Subject> subjects = subjectService.list();
        if (subjects != null && subjects.size() != 0){
            return new AjaxMessage(0,"",subjects);
        }
        return new AjaxMessage(1,"查询失败");
    }
}
